import {createRouter, createWebHistory} from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
    {
        path: '/',
        name: 'home',
        component: HomeView
    },
    {
        path: '/login',
        name: 'login',
        component: () => import('@/views/LoginView.vue')
    },
    {
        name: 'productLst',
        path: "/product/lst",
        component: ()=>import('@/views/pack/product/LstView.vue')
    },
    {
        name: 'productAdd',
        path: "/product/add/:id?",
        component: ()=>import('@/views/pack/product/EditView.vue')
    },
    {
        name: 'pack',
        path: "/pack/lst",
        component: ()=>import('@/views/pack/package/LstView.vue')
    },
    {
        name: 'packEdit',
        path: "/pack/edit/:id?",
        component: ()=>import('@/views/pack/package/EditView.vue')
    },
    {
        name: 'packProduct',
        path: "/pack/product/:id",
        component: ()=>import('@/views/pack/package/ProductView.vue')
    },
    {
        name: 'supplier',
        path: "/plate/supplier",
        component: ()=>import('@/views/plate/supplier/LstView.vue')
    },
    {
        name: 'supplierEdit',
        path: "/plate/supplier/edit/:id?",
        component: ()=>import('@/views/plate/supplier/EditView.vue')
    },
    {
        name: 'supplierCode',
        path: "/plate/supplier/code/:id",
        component: ()=>import('@/views/plate/supplier/CodeView.vue')
    },
    {
        name: 'recode',
        path: "/plate/recode",
        component: ()=>import('@/views/plate/supplier/RecodeView.vue')
    },
    {
        name: 'productCode',
        path: "/product/code/:id",
        component: ()=>import('@/views/pack/product/CodeView.vue')
    },
    {
        name: 'order',
        path: "/product/order",
        component: ()=>import('@/views/pack/product/OrderView.vue')
    },
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

router.beforeEach((to, from, next) => {
    document.title = "智行九州管理系统"
    next()
})


export default router
